]>
glassweightruler.freedombox.rocks Git - Ventoy.git/blob - SQUASHFS/squashfs-tools-4.4/squashfs-tools/info.c
2 * Create a squashfs filesystem. This is a highly compressed read only
5 * Copyright (c) 2013, 2014, 2019
6 * Phillip Lougher <phillip@squashfs.org.uk>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2,
11 * or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 #include <sys/ioctl.h>
36 #include <sys/types.h>
40 #include "squashfs_fs.h"
41 #include "mksquashfs.h"
43 #include "progressbar.h"
44 #include "caches-queues-lists.h"
46 static int silent
= 0;
47 static struct dir_ent
*ent
= NULL
;
49 pthread_t info_thread
;
58 void update_info(struct dir_ent
*dir_ent
)
66 struct dir_ent
*dir_ent
= ent
;
71 if(dir_ent
->our_dir
->subpath
[0] != '\0')
72 INFO("%s/%s\n", dir_ent
->our_dir
->subpath
, dir_ent
->name
);
74 INFO("/%s\n", dir_ent
->name
);
80 disable_progress_bar();
82 printf("Queue and Cache status dump\n");
83 printf("===========================\n");
85 printf("file buffer queue (reader thread -> deflate thread(s))\n");
86 dump_queue(to_deflate
);
88 printf("uncompressed fragment queue (reader thread -> fragment"
90 dump_queue(to_process_frag
);
92 printf("processed fragment queue (fragment thread(s) -> main"
94 dump_seq_queue(to_main
, 1);
96 printf("compressed block queue (deflate thread(s) -> main thread)\n");
97 dump_seq_queue(to_main
, 0);
99 printf("uncompressed packed fragment queue (main thread -> fragment"
100 " deflate thread(s))\n");
104 printf("locked frag queue (compressed frags waiting while multi-block"
105 " file is written)\n");
106 dump_queue(locked_fragment
);
108 printf("compressed block queue (main & fragment deflate threads(s) ->"
109 " writer thread)\n");
110 dump_queue(to_writer
);
112 printf("compressed fragment queue (fragment deflate threads(s) ->"
113 "fragment order thread)\n");
115 dump_seq_queue(to_order
, 0);
117 printf("compressed block queue (main & fragment order threads ->"
118 " writer thread)\n");
119 dump_queue(to_writer
);
122 printf("read cache (uncompressed blocks read by reader thread)\n");
123 dump_cache(reader_buffer
);
125 printf("block write cache (compressed blocks waiting for the writer"
127 dump_cache(bwriter_buffer
);
128 printf("fragment write cache (compressed fragments waiting for the"
129 " writer thread)\n");
130 dump_cache(fwriter_buffer
);
132 printf("fragment cache (frags waiting to be compressed by fragment"
133 " deflate thread(s))\n");
134 dump_cache(fragment_buffer
);
136 printf("fragment reserve cache (avoids pipeline stall if frag cache"
137 " full in dup check)\n");
138 dump_cache(reserve_cache
);
140 enable_progress_bar();
144 void *info_thrd(void *arg
)
147 struct timespec timespec
= { .tv_sec
= 1, .tv_nsec
= 0 };
148 int sig
, waiting
= 0;
150 sigemptyset(&sigmask
);
151 sigaddset(&sigmask
, SIGQUIT
);
152 sigaddset(&sigmask
, SIGHUP
);
156 sig
= sigtimedwait(&sigmask
, NULL
, ×pec
);
158 sig
= sigwaitinfo(&sigmask
, NULL
);
163 /* interval timed out */
167 /* if waiting, the wait will be longer, but
171 BAD_ERROR("sigtimedwait/sigwaitinfo failed "
172 "because %s\n", strerror(errno
));
176 if(sig
== SIGQUIT
&& !waiting
) {
179 /* set one second interval period, if ^\ received
180 within then, dump queue and cache status */
190 pthread_create(&info_thread
, NULL
, info_thrd
, NULL
);