xref: /aosp_15_r20/external/toybox/android/device/generated/globals.h (revision cf5a6c84e2b8763fc1a7db14496fd4742913b199)
1 struct log_data {
2   char *t, *p;
3 
4   int pri;
5 };
6 
7 struct dmesg_data {
8   long n, s;
9 
10   int use_color;
11   time_t tea;
12 };
13 
14 struct gzip_data {
15   int level;
16 };
17 
18 struct hostname_data {
19   char *F;
20 };
21 
22 struct killall_data {
23   char *s;
24 
25   int signum;
26   pid_t cur_pid;
27   char **names;
28   short *err;
29   struct int_list { struct int_list *next; int val; } *pids;
30 };
31 
32 struct md5sum_data {
33   int sawline;
34 };
35 
36 struct mknod_data {
37   char *Z, *m;
38 };
39 
40 struct mktemp_data {
41   char *p, *tmpdir;
42 };
43 
44 struct mount_data {
45   struct arg_list *o;
46   char *t, *O;
47 
48   unsigned long flags;
49   char *opts;
50   int okuser;
51 };
52 
53 struct pidof_data {
54   char *o;
55 };
56 
57 struct seq_data {
58   char *s, *f;
59 
60   int precision, buflen;
61 };
62 
63 struct umount_data {
64   struct arg_list *t;
65 
66   char *types;
67 };
68 
69 struct ifconfig_data {
70   int sockfd;
71 };
72 
73 struct microcom_data {
74   long s;
75 
76   int fd, stok;
77   struct termios old_stdin, old_fd;
78 };
79 
80 struct netcat_data {
81   char *f, *s, *o, *O;
82   long q, p, W, w;
83 
84   unsigned ofd, olast, opos, ocount[2];
85   char obuf[16];
86 };
87 
88 struct netstat_data {
89   struct num_cache *inodes;
90   int wpad;
91 };
92 
93 struct ping_data {
94   char *I;
95   long w, W, i, s, c, t, m;
96 
97   struct sockaddr *sa;
98   int sock;
99   unsigned long sent, recv, fugit, min, max;
100 };
101 
102 struct tunctl_data {
103   char *u;
104 };
105 
106 struct base64_data {
107   long w;
108 
109   unsigned total;
110   unsigned n;  // number of bits used in encoding. 5 for base32, 6 for base64
111   unsigned align;  // number of bits to align to
112 };
113 
114 struct blkdiscard_data {
115   long o, l;
116 };
117 
118 struct blkid_data {
119   struct arg_list *s;
120   char *o;
121 };
122 
123 struct blockdev_data {
124   long setra, setbsz;
125 };
126 
127 struct chrt_data {
128   long p;
129 };
130 
131 struct devmem_data {
132   char *f;
133 };
134 
135 struct dos2unix_data {
136   char *tempfile;
137 };
138 
139 struct fallocate_data {
140   long o, l;
141 };
142 
143 struct fmt_data {
144   long width;
145 
146   int level, pos;
147 };
148 
149 struct free_data {
150   unsigned bits;
151   unsigned long long units;
152   char *buf;
153 };
154 
155 struct getopt_data {
156   struct arg_list *l;
157   char *o, *n;
158 };
159 
160 struct gpiodetect_data {
161   struct double_list *chips;
162   int chip_count;
163 };
164 
165 struct hwclock_data {
166   char *f;
167 };
168 
169 struct i2cdetect_data {
170   long F;
171 };
172 
173 struct ionice_data {
174   long p, n, c;
175 };
176 
177 struct losetup_data {
178   char *j;
179   long o, S;
180 
181   int openflags;
182   dev_t jdev;
183   ino_t jino;
184   char *dir;
185 };
186 
187 struct lsattr_data {
188   long v, p;
189 
190   unsigned add, rm, set;
191   // !add and !rm tell us whether they were used, but `chattr =` is meaningful.
192   int have_set;
193 };
194 
195 struct lsusb_data {
196   char *i;
197   long x, n;
198 
199   void *ids, *class;
200   int count;
201 };
202 
203 struct makedevs_data {
204   char *d;
205 };
206 
207 struct mkswap_data {
208   char *L;
209 };
210 
211 struct modinfo_data {
212   char *F, *k, *b;
213 
214   long mod;
215   int count;
216 };
217 
218 struct nbd_client_data {
219   long b;
220 
221   int nbd;
222 };
223 
224 struct nsenter_data {
225   char *UupnmiC[7];
226   long t;
227 };
228 
229 struct readelf_data {
230   char *x, *p;
231 
232   char *elf, *shstrtab, *f;
233   unsigned long long shoff, phoff, size, shstrtabsz;
234   int bits, endian, shnum, shentsize, phentsize;
235 };
236 
237 struct realpath_data {
238   char *R, *relative_base;
239 };
240 
241 struct rtcwake_data {
242   long t, s;
243   char *m, *d;
244 };
245 
246 struct setfattr_data {
247   char *x, *v, *n;
248 };
249 
250 struct setsid_data {
251   long c;
252 };
253 
254 struct stat_data {
255   char *c;
256 
257   union {
258     struct stat st;
259     struct statfs sf;
260   } stat;
261   char *file, *pattern;
262   int patlen;
263 };
264 
265 struct swapon_data {
266   long p;
267 };
268 
269 struct tac_data {
270   struct double_list *dl;
271 };
272 
273 struct timeout_data {
274   char *s, *k;
275 
276   struct pollfd pfd;
277   sigjmp_buf sj;
278   int fds[2], pid, rc;
279 };
280 
281 struct truncate_data {
282   char *s;
283 
284   long long size;
285   int type;
286 };
287 
288 struct uclampset_data {
289   long M, m, p;
290 };
291 
292 struct watch_data {
293   int n;
294 
295   pid_t pid, oldpid;
296 };
297 
298 struct xxd_data {
299   long s, g, o, l, c;
300 };
301 
302 struct brctl_data {
303     int sockfd;
304 };
305 
306 struct diff_data {
307   long U;
308   struct arg_list *L;
309   char *F, *S, *new_line_format, *old_line_format, *unchanged_line_format;
310 
311   int dir_num, size, is_binary, is_symlink, differ, change, len[2], *offset[2];
312   struct stat st[2];
313   struct {
314     char **list;
315     int nr_elm;
316   } dir[2];
317   struct {
318     FILE *fp;
319     int len;
320   } file[2];
321   struct {
322     char *name;
323     int len;
324   } link[2];
325 };
326 
327 struct expr_data {
328   char **tok, *delete;
329 };
330 
331 struct getfattr_data {
332   char *n;
333 };
334 
335 struct lsof_data {
336   struct arg_list *p;
337 
338   struct stat *sought_files;
339   struct double_list *all_sockets, *files;
340   int last_shown_pid, shown_header;
341 };
342 
343 struct modprobe_data {
344   struct arg_list *dirs;
345 
346   struct arg_list *probes, *dbase[256];
347   char *cmdopts;
348   int nudeps, symreq;
349 };
350 
351 struct more_data {
352   struct termios inf;
353   int cin_fd;
354 };
355 
356 struct stty_data {
357   char *F;
358 
359   int fd, col;
360   unsigned output_cols;
361 };
362 
363 struct tr_data {
364   short *map;
365   int len1, len2;
366 };
367 
368 struct traceroute_data {
369   long max_ttl;
370   long port;
371   long ttl_probes;
372   char *src_ip;
373   long tos;
374   long wait_time;
375   struct arg_list *loose_source;
376   long pause_time;
377   long first_ttl;
378   char *iface;
379 
380   uint32_t gw_list[9];
381   int recv_sock;
382   int snd_sock;
383   unsigned msg_len;
384   char *packet;
385   uint32_t ident;
386   int istraceroute6;
387 };
388 
389 struct vi_data {
390   char *c, *s;
391 
392   char *filename;
393   int vi_mode, tabstop, list, cur_col, cur_row, scr_row, drawn_row, drawn_col,
394       count0, count1, vi_mov_flag;
395   unsigned screen_height, screen_width;
396   char vi_reg, *last_search;
397   struct str_line {
398     int alloc, len;
399     char *data;
400   } *il;
401   size_t screen, cursor; //offsets
402   //yank buffer
403   struct yank_buf {
404     char reg;
405     int alloc;
406     char *data;
407   } yank;
408 
409   size_t filesize;
410 // mem_block contains RO data that is either original file as mmap
411 // or heap allocated inserted data
412   struct block_list {
413     struct block_list *next, *prev;
414     struct mem_block {
415       size_t size, len;
416       enum alloc_flag {
417         MMAP,  //can be munmap() before exit()
418         HEAP,  //can be free() before exit()
419         STACK, //global or stack perhaps toybuf
420       } alloc;
421       const char *data;
422     } *node;
423   } *text;
424 
425 // slices do not contain actual allocated data but slices of data in mem_block
426 // when file is first opened it has only one slice.
427 // after inserting data into middle new mem_block is allocated for insert data
428 // and 3 slices are created, where first and last slice are pointing to original
429 // mem_block with offsets, and middle slice is pointing to newly allocated block
430 // When deleting, data is not freed but mem_blocks are sliced more such way that
431 // deleted data left between 2 slices
432   struct slice_list {
433     struct slice_list *next, *prev;
434     struct slice {
435       size_t len;
436       const char *data;
437     } *node;
438   } *slices;
439 };
440 
441 struct basename_data {
442   char *s;
443 };
444 
445 struct cal_data {
446   struct tm *now;
447 };
448 
449 struct chgrp_data {
450   uid_t owner;
451   gid_t group;
452   char *owner_name, *group_name;
453   int symfollow;
454 };
455 
456 struct chmod_data {
457   char *mode;
458 };
459 
460 struct cmp_data {
461   long n;
462 
463   int fd;
464   char *name;
465 };
466 
467 struct cp_data {
468   union {
469     // install's options
470     struct {
471       char *g, *o, *m, *t;
472     } i;
473     // cp's options
474     struct {
475       char *t, *preserve;
476     } c;
477   };
478 
479   char *destname;
480   struct stat top;
481   int (*callback)(struct dirtree *try);
482   uid_t uid;
483   gid_t gid;
484   int pflags;
485 };
486 
487 struct cpio_data {
488   char *F, *H, *R;
489 };
490 
491 struct cut_data {
492   char *d, *O;
493   struct arg_list *select[5]; // we treat them the same, so loop through
494 
495   unsigned line;
496   int pairs;
497   regex_t reg;
498 };
499 
500 struct date_data {
501   char *s, *r, *I, *D, *d;
502 
503   unsigned nano;
504 };
505 
506 struct dd_data {
507   // Display fields
508   int show_xfer, show_records;
509   unsigned long long bytes, in_full, in_part, out_full, out_part, start;
510 };
511 
512 struct df_data {
513   struct arg_list *t;
514 
515   int units, width[6];
516 };
517 
518 struct du_data {
519   long d;
520 
521   unsigned long depth, total;
522   dev_t st_dev;
523   void *inodes;
524 };
525 
526 struct env_data {
527   struct arg_list *u;
528   char *e;
529 };
530 
531 struct expand_data {
532   struct arg_list *t;
533 
534   unsigned tabcount, *tab;
535 };
536 
537 struct file_data {
538   int max_name_len;
539   off_t len;
540 };
541 
542 struct find_data {
543   char **filter;
544   struct double_list *argdata;
545   int topdir, xdev, depth;
546   time_t now;
547   long max_bytes;
548   char *start;
549 };
550 
551 struct grep_data {
552   long m, A, B, C;
553   struct arg_list *f, *e, *M, *S, *exclude_dir;
554   char *color;
555 
556   char *purple, *cyan, *red, *green, *grey;
557   struct double_list *reg;
558   int found, tried, delim;
559   struct arg_list **fixed;
560 };
561 
562 struct head_data {
563   long c, n;
564 
565   int file_no;
566 };
567 
568 struct iconv_data {
569   char *f, *t;
570 
571   void *ic;
572 };
573 
574 struct id_data {
575   int is_groups;
576 };
577 
578 struct kill_data {
579   char *s;
580   struct arg_list *o;
581 };
582 
583 struct ln_data {
584   char *t;
585 };
586 
587 struct logger_data {
588   char *p, *t;
589 
590   int priority;
591 };
592 
593 struct ls_data {
594   long w, l, block_size;
595   char *color, *sort;
596 
597   struct dirtree *files, *singledir;
598   unsigned screen_width;
599   int nl_title;
600   char *escmore;
601 };
602 
603 struct mkdir_data {
604   char *m, *Z;
605 };
606 
607 struct mkfifo_data {
608   char *m, *Z;
609 
610   mode_t mode;
611 };
612 
613 struct nice_data {
614   long n;
615 };
616 
617 struct nl_data {
618   char *s, *n, *b;
619   long w, l, v;
620 
621   // Count of consecutive blank lines for -l has to persist between files
622   long lcount, slen;
623 };
624 
625 struct od_data {
626   struct arg_list *t;
627   char *A;
628   long N, w, j;
629 
630   int address_idx;
631   unsigned types, leftover, star;
632   char *buf; // Points to buffers[0] or buffers[1].
633   char *bufs[2]; // Used to detect duplicate lines.
634   off_t pos;
635 };
636 
637 struct paste_data {
638   char *d;
639 
640   int files;
641 };
642 
643 struct patch_data {
644   char *i, *d;
645   long v, p, g, F;
646 
647   void *current_hunk;
648   long oldline, oldlen, newline, newlen, linenum, outnum;
649   int context, state, filein, fileout, filepatch, hunknum;
650   char *tempname;
651 };
652 
653 struct ps_data {
654   union {
655     struct {
656       struct arg_list *G, *g, *U, *u, *t, *s, *p, *O, *o, *P, *k;
657     } ps;
658     struct {
659       long n, m, d, s;
660       struct arg_list *u, *p, *o, *k, *O;
661     } top;
662     struct {
663       char *L;
664       struct arg_list *G, *g, *P, *s, *t, *U, *u;
665       char *d;
666 
667       void *regexes, *snapshot;
668       int signal;
669       pid_t self, match;
670     } pgrep;
671   };
672 
673   struct ps_ptr_len {
674     void *ptr;
675     long len;
676   } gg, GG, pp, PP, ss, tt, uu, UU;
677   struct dirtree *threadparent;
678   unsigned width, height, scroll;
679   dev_t tty;
680   void *fields, *kfields;
681   long long ticks, bits, time;
682   int kcount, forcek, sortpos, pidlen;
683   int (*match_process)(long long *slot);
684   void (*show_process)(void *tb);
685 };
686 
687 struct renice_data {
688   long n;
689 };
690 
691 struct sed_data {
692   char *i;
693   struct arg_list *f, *e;
694 
695   // processed pattern list
696   struct double_list *pattern;
697 
698   char *nextline, *remember, *tarxform;
699   void *restart, *lastregex;
700   long nextlen, rememberlen, count;
701   int fdout, noeol;
702   unsigned xx, tarxlen, xflags;
703   char delim, xftype;
704 };
705 
706 struct sort_data {
707   char *t;
708   struct arg_list *k;
709   char *o, *T, S;
710 
711   void *key_list;
712   unsigned linecount;
713   char **lines, *name;
714 };
715 
716 struct split_data {
717   long n, l, b, a;
718 
719   char *outfile;
720 };
721 
722 struct strings_data {
723   long n;
724   char *t;
725 };
726 
727 struct tail_data {
728   long n, c;
729   char *s;
730 
731   int file_no, last_fd, ss;
732   struct xnotify *not;
733   struct {
734     char *path;
735     int fd;
736     struct dev_ino di;
737   } *F;
738 };
739 
740 struct tar_data {
741   char *f, *C, *I;
742   struct arg_list *T, *X, *xform;
743   long strip;
744   char *to_command, *owner, *group, *mtime, *mode, *sort;
745   struct arg_list *exclude;
746 
747   struct double_list *incl, *excl, *seen;
748   struct string_list *dirs;
749   char *cwd, **xfsed;
750   int fd, ouid, ggid, hlc, warn, sparselen, pid, xfpipe[2];
751   struct dev_ino archive_di;
752   long long *sparse;
753   time_t mtt;
754 
755   // hardlinks seen so far (hlc many)
756   struct {
757     char *arg;
758     struct dev_ino di;
759   } *hlx;
760 
761   // Parsed information about a tar header.
762   struct tar_header {
763     char *name, *link_target, *uname, *gname;
764     long long size, ssize, oldsparse;
765     uid_t uid;
766     gid_t gid;
767     mode_t mode;
768     time_t mtime;
769     dev_t device;
770   } hdr;
771 };
772 
773 struct tee_data {
774   void *outputs;
775   int out;
776 };
777 
778 struct touch_data {
779   char *t, *r, *d;
780 };
781 
782 struct ulimit_data {
783   long P;
784 };
785 
786 struct uniq_data {
787   long w, s, f;
788 
789   long repeats;
790 };
791 
792 struct uudecode_data {
793   char *o;
794 };
795 
796 struct wc_data {
797   unsigned long totals[5];
798 };
799 
800 struct xargs_data {
801   long s, n, P;
802   char *E;
803 
804   long entries, bytes, np;
805   char delim;
806   FILE *tty;
807 };
808 extern union global_union {
809 	struct log_data log;
810 	struct dmesg_data dmesg;
811 	struct gzip_data gzip;
812 	struct hostname_data hostname;
813 	struct killall_data killall;
814 	struct md5sum_data md5sum;
815 	struct mknod_data mknod;
816 	struct mktemp_data mktemp;
817 	struct mount_data mount;
818 	struct pidof_data pidof;
819 	struct seq_data seq;
820 	struct umount_data umount;
821 	struct ifconfig_data ifconfig;
822 	struct microcom_data microcom;
823 	struct netcat_data netcat;
824 	struct netstat_data netstat;
825 	struct ping_data ping;
826 	struct tunctl_data tunctl;
827 	struct base64_data base64;
828 	struct blkdiscard_data blkdiscard;
829 	struct blkid_data blkid;
830 	struct blockdev_data blockdev;
831 	struct chrt_data chrt;
832 	struct devmem_data devmem;
833 	struct dos2unix_data dos2unix;
834 	struct fallocate_data fallocate;
835 	struct fmt_data fmt;
836 	struct free_data free;
837 	struct getopt_data getopt;
838 	struct gpiodetect_data gpiodetect;
839 	struct hwclock_data hwclock;
840 	struct i2cdetect_data i2cdetect;
841 	struct ionice_data ionice;
842 	struct losetup_data losetup;
843 	struct lsattr_data lsattr;
844 	struct lsusb_data lsusb;
845 	struct makedevs_data makedevs;
846 	struct mkswap_data mkswap;
847 	struct modinfo_data modinfo;
848 	struct nbd_client_data nbd_client;
849 	struct nsenter_data nsenter;
850 	struct readelf_data readelf;
851 	struct realpath_data realpath;
852 	struct rtcwake_data rtcwake;
853 	struct setfattr_data setfattr;
854 	struct setsid_data setsid;
855 	struct stat_data stat;
856 	struct swapon_data swapon;
857 	struct tac_data tac;
858 	struct timeout_data timeout;
859 	struct truncate_data truncate;
860 	struct uclampset_data uclampset;
861 	struct watch_data watch;
862 	struct xxd_data xxd;
863 	struct brctl_data brctl;
864 	struct diff_data diff;
865 	struct expr_data expr;
866 	struct getfattr_data getfattr;
867 	struct lsof_data lsof;
868 	struct modprobe_data modprobe;
869 	struct more_data more;
870 	struct stty_data stty;
871 	struct tr_data tr;
872 	struct traceroute_data traceroute;
873 	struct vi_data vi;
874 	struct basename_data basename;
875 	struct cal_data cal;
876 	struct chgrp_data chgrp;
877 	struct chmod_data chmod;
878 	struct cmp_data cmp;
879 	struct cp_data cp;
880 	struct cpio_data cpio;
881 	struct cut_data cut;
882 	struct date_data date;
883 	struct dd_data dd;
884 	struct df_data df;
885 	struct du_data du;
886 	struct env_data env;
887 	struct expand_data expand;
888 	struct file_data file;
889 	struct find_data find;
890 	struct grep_data grep;
891 	struct head_data head;
892 	struct iconv_data iconv;
893 	struct id_data id;
894 	struct kill_data kill;
895 	struct ln_data ln;
896 	struct logger_data logger;
897 	struct ls_data ls;
898 	struct mkdir_data mkdir;
899 	struct mkfifo_data mkfifo;
900 	struct nice_data nice;
901 	struct nl_data nl;
902 	struct od_data od;
903 	struct paste_data paste;
904 	struct patch_data patch;
905 	struct ps_data ps;
906 	struct renice_data renice;
907 	struct sed_data sed;
908 	struct sort_data sort;
909 	struct split_data split;
910 	struct strings_data strings;
911 	struct tail_data tail;
912 	struct tar_data tar;
913 	struct tee_data tee;
914 	struct touch_data touch;
915 	struct ulimit_data ulimit;
916 	struct uniq_data uniq;
917 	struct uudecode_data uudecode;
918 	struct wc_data wc;
919 	struct xargs_data xargs;
920 } this;
921