-
-
Notifications
You must be signed in to change notification settings - Fork 209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
XdpAppInfo cleanups #1619
Open
GeorgesStavracas
wants to merge
17
commits into
flatpak:main
Choose a base branch
from
GeorgesStavracas:gbsneto/xdp-app-info-followups
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
XdpAppInfo cleanups #1619
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4fe5f23
app-info: Unify comment style
GeorgesStavracas 0690898
app-info: Mark various vfunc overrides as static
GeorgesStavracas 5e55723
app-info: Cosmetics
GeorgesStavracas 437f712
app-info: Remove requires_pid_mapping
GeorgesStavracas 671d971
app-info: Use flags instead of booleans
GeorgesStavracas eb14fae
app-info: Add a stub GInitable implementation
GeorgesStavracas 2a6e312
app-info: Tighten up a check into an assert
GeorgesStavracas b6c659d
app-info: Turn "engine" into a construct-only property
GeorgesStavracas cf0ac24
app-info: Make "id" into a construct-only property
GeorgesStavracas b25bde5
app-info: Turn "instance" into a construct-only property
GeorgesStavracas d98213a
app-info: Turn "pidfd" into a construct-only property
GeorgesStavracas 120665c
app-info: Turn "flags" into a construct-only property
GeorgesStavracas 1fa46c6
app-info: Turn "g-app-info" into a construct-only property
GeorgesStavracas 566e476
app-info-host: Disambiguate xdp_app_info_host_new_full()
GeorgesStavracas 862acad
app-info: Add REQUIRE_GAPPINFO flag
GeorgesStavracas 20a6a2b
app-info: Rework GAppInfo management
GeorgesStavracas c8b31e4
app-info: Use engine name to determine host apps
GeorgesStavracas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,9 +65,7 @@ typedef struct _XdpAppInfoPrivate | |
char *instance; | ||
int pidfd; | ||
GAppInfo *gappinfo; | ||
gboolean supports_opath; | ||
gboolean has_network; | ||
gboolean requires_pid_mapping; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe I screwed something up when refactoring XdpAppInfo? Might be worth double checking what this was used for... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
XdpAppInfoFlags flags; | ||
|
||
/* pid namespace mapping */ | ||
GMutex pidns_lock; | ||
|
@@ -111,15 +109,13 @@ xdp_app_info_init (XdpAppInfo *app_info) | |
} | ||
|
||
void | ||
xdp_app_info_initialize (XdpAppInfo *app_info, | ||
const char *engine, | ||
const char *app_id, | ||
const char *instance, | ||
int pidfd, | ||
GAppInfo *gappinfo, | ||
gboolean supports_opath, | ||
gboolean has_network, | ||
gboolean requires_pid_mapping) | ||
xdp_app_info_initialize (XdpAppInfo *app_info, | ||
const char *engine, | ||
const char *app_id, | ||
const char *instance, | ||
int pidfd, | ||
GAppInfo *gappinfo, | ||
XdpAppInfoFlags flags) | ||
{ | ||
XdpAppInfoPrivate *priv = xdp_app_info_get_instance_private (app_info); | ||
|
||
|
@@ -128,9 +124,7 @@ xdp_app_info_initialize (XdpAppInfo *app_info, | |
priv->instance = g_strdup (instance); | ||
priv->pidfd = dup (pidfd); | ||
g_set_object (&priv->gappinfo, gappinfo); | ||
priv->supports_opath = supports_opath; | ||
priv->has_network = has_network; | ||
priv->requires_pid_mapping = requires_pid_mapping; | ||
priv->flags = flags; | ||
} | ||
|
||
gboolean | ||
|
@@ -195,7 +189,7 @@ xdp_app_info_has_network (XdpAppInfo *app_info) | |
|
||
priv = xdp_app_info_get_instance_private (app_info); | ||
|
||
return priv->has_network; | ||
return (priv->flags & XDP_APP_INFO_FLAG_HAS_NETWORK) != 0; | ||
} | ||
|
||
gboolean | ||
|
@@ -234,7 +228,6 @@ static char * | |
remap_path (XdpAppInfo *app_info, | ||
const char *path) | ||
{ | ||
|
||
if (!XDP_APP_INFO_GET_CLASS (app_info)->remap_path) | ||
return g_strdup (path); | ||
|
||
|
@@ -262,8 +255,9 @@ verify_proc_self_fd (XdpAppInfo *app_info, | |
path_buffer[symlink_size] = 0; | ||
|
||
/* All normal paths start with /, but some weird things | ||
don't, such as socket:[27345] or anon_inode:[eventfd]. | ||
We don't support any of these */ | ||
* don't, such as socket:[27345] or anon_inode:[eventfd]. | ||
* We don't support any of these. | ||
*/ | ||
if (path_buffer[0] != '/') | ||
{ | ||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_FILENAME, | ||
|
@@ -272,23 +266,25 @@ verify_proc_self_fd (XdpAppInfo *app_info, | |
} | ||
|
||
/* File descriptors to actually deleted files have " (deleted)" | ||
appended to them. This also happens to some fake fd types | ||
like shmem which are "/<name> (deleted)". All such | ||
files are considered invalid. Unfortunately this also | ||
matches files with filenames that actually end in " (deleted)", | ||
but there is not much to do about this. */ | ||
* appended to them. This also happens to some fake fd types | ||
* like shmem which are "/<name> (deleted)". All such | ||
* files are considered invalid. Unfortunately this also | ||
* matches files with filenames that actually end in " (deleted)", | ||
* but there is not much to do about this. | ||
*/ | ||
if (g_str_has_suffix (path_buffer, " (deleted)")) | ||
{ | ||
const char *mountpoint = xdp_get_documents_mountpoint (); | ||
|
||
if (mountpoint != NULL && g_str_has_prefix (path_buffer, mountpoint)) | ||
{ | ||
/* Unfortunately our workaround for dcache purging triggers | ||
o_path file descriptors on the fuse filesystem being | ||
marked as deleted, so we have to allow these here and | ||
rewrite them. This is safe, becase we will stat the file | ||
and compare to make sure we end up on the right file. */ | ||
path_buffer[symlink_size - strlen(" (deleted)")] = 0; | ||
* o_path file descriptors on the fuse filesystem being | ||
* marked as deleted, so we have to allow these here and | ||
* rewrite them. This is safe, becase we will stat the file | ||
* and compare to make sure we end up on the right file. | ||
*/ | ||
path_buffer[symlink_size - strlen (" (deleted)")] = 0; | ||
} | ||
else | ||
{ | ||
|
@@ -438,7 +434,7 @@ xdp_app_info_get_path_for_fd (XdpAppInfo *app_info, | |
return NULL; | ||
} | ||
|
||
if (!priv->supports_opath) | ||
if ((priv->flags & XDP_APP_INFO_FLAG_SUPPORTS_OPATH) == 0) | ||
{ | ||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED, | ||
"App \"%s\" of type %s does not support O_PATH fd passing", | ||
|
@@ -876,7 +872,7 @@ xdp_connection_create_host_app_info_sync (GDBusConnection *connection, | |
if (is_sandboxed) | ||
{ | ||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, | ||
"Can't manually register a flatpak application"); | ||
"Can't manually register a Flatpak application"); | ||
return NULL; | ||
} | ||
|
||
|
@@ -886,7 +882,7 @@ xdp_connection_create_host_app_info_sync (GDBusConnection *connection, | |
if (is_sandboxed) | ||
{ | ||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, | ||
"Can't manually register a snap application"); | ||
"Can't manually register a Snap application"); | ||
return NULL; | ||
} | ||
|
||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typedef enum _XdpAppInfoFlags
tbh, I'm unsure why this even is a pattern in e.g. mutter but at least it makes it easy to grep for the declaration...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice because one can use ctags to go directly to the actual struct, instead of the typedef, by adding a _ in front of the name.