]> git.ipfire.org Git - people/ms/pakfire.git/commitdiff
jail: Move struct declarations out of the large struct
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 Dec 2023 17:27:30 +0000 (17:27 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 Dec 2023 17:27:30 +0000 (17:27 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/jail.c

index f3b15c5ed437c71d607adfab30b4a8dbc5d93983..2cb4fd562ed50afaf7d91ddb2f2ebbf6c6f3f83b 100644 (file)
@@ -82,6 +82,33 @@ static const struct environ {
        { NULL, NULL },
 };
 
+struct pakfire_log_buffer {
+       char data[BUFFER_SIZE];
+       size_t used;
+};
+
+enum pakfire_jail_pty_flags {
+       PAKFIRE_JAIL_PTY_READY_TO_READ  = (1 << 0),
+       PAKFIRE_JAIL_PTY_READY_TO_WRITE = (1 << 1),
+};
+
+struct pakfire_jail_pty_stdio {
+       // File Descriptor
+       int fd;
+
+       // Buffer
+       struct pakfire_log_buffer buffer;
+
+       // Terminal Attributes
+       struct termios attrs;
+
+       // File Descriptor Flags
+       int fdflags;
+
+       // IO Flags
+       enum pakfire_jail_pty_flags flags;
+};
+
 struct pakfire_jail_mountpoint {
        char source[PATH_MAX];
        char target[PATH_MAX];
@@ -114,11 +141,6 @@ struct pakfire_jail {
        unsigned int num_mountpoints;
 };
 
-struct pakfire_log_buffer {
-       char data[BUFFER_SIZE];
-       size_t used;
-};
-
 struct pakfire_jail_exec {
        int flags;
 
@@ -170,26 +192,14 @@ struct pakfire_jail_exec {
                // The path to the console
                char console[PATH_MAX];
 
-               // The master fd
+               // The master device
                struct pakfire_jail_pty_master {
                        int fd;
-
-                       enum pakfire_jail_pty_flags {
-                               PAKFIRE_JAIL_PTY_READY_TO_READ  = (1 << 0),
-                               PAKFIRE_JAIL_PTY_READY_TO_WRITE = (1 << 1),
-                       } flags;
-               } master;
-
-               // Standard Input
-               struct pakfire_jail_pty_stdio {
-                       int fd;
-                       struct pakfire_log_buffer buffer;
-                       struct termios attrs;
-                       int fdflags;
                        enum pakfire_jail_pty_flags flags;
-               } stdin;
+               } master;
 
-               // Standard Output
+               // Standard Input/Output
+               struct pakfire_jail_pty_stdio stdin;
                struct pakfire_jail_pty_stdio stdout;
        } pty;
 };