walk.c (247052) | walk.c (250407) |
---|---|
1/* $NetBSD: walk.c,v 1.24 2008/12/28 21:51:46 christos Exp $ */ 2 3/* 4 * Copyright (c) 2001 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Luke Mewburn for Wasabi Systems, Inc. 8 * --- 23 unchanged lines hidden (view full) --- 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38 39#include <sys/cdefs.h> | 1/* $NetBSD: walk.c,v 1.24 2008/12/28 21:51:46 christos Exp $ */ 2 3/* 4 * Copyright (c) 2001 Wasabi Systems, Inc. 5 * All rights reserved. 6 * 7 * Written by Luke Mewburn for Wasabi Systems, Inc. 8 * --- 23 unchanged lines hidden (view full) --- 32 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 33 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 35 * POSSIBILITY OF SUCH DAMAGE. 36 */ 37 38 39#include <sys/cdefs.h> |
40__FBSDID("$FreeBSD: head/usr.sbin/makefs/walk.c 247052 2013-02-20 19:32:31Z brooks $"); | 40__FBSDID("$FreeBSD: head/usr.sbin/makefs/walk.c 250407 2013-05-09 14:43:36Z brooks $"); |
41 42#include <sys/param.h> 43 44#include <assert.h> 45#include <errno.h> 46#include <fcntl.h> 47#include <stdio.h> 48#include <dirent.h> --- 250 unchanged lines hidden (view full) --- 299 300 if (debug & DEBUG_APPLY_SPECFILE) 301 printf("apply_specfile: %s, %s %p\n", specfile, dir, parent); 302 303 /* read in the specfile */ 304 if ((fp = fopen(specfile, "r")) == NULL) 305 err(1, "Can't open `%s'", specfile); 306 TIMER_START(start); | 41 42#include <sys/param.h> 43 44#include <assert.h> 45#include <errno.h> 46#include <fcntl.h> 47#include <stdio.h> 48#include <dirent.h> --- 250 unchanged lines hidden (view full) --- 299 300 if (debug & DEBUG_APPLY_SPECFILE) 301 printf("apply_specfile: %s, %s %p\n", specfile, dir, parent); 302 303 /* read in the specfile */ 304 if ((fp = fopen(specfile, "r")) == NULL) 305 err(1, "Can't open `%s'", specfile); 306 TIMER_START(start); |
307 root = mtree_readspec(fp); | 307 root = spec(fp); |
308 TIMER_RESULTS(start, "spec"); 309 if (fclose(fp) == EOF) 310 err(1, "Can't close `%s'", specfile); 311 312 /* perform some sanity checks */ 313 if (root == NULL) 314 errx(1, "Specfile `%s' did not contain a tree", specfile); 315 assert(strcmp(root->name, ".") == 0); 316 assert(root->type == F_DIR); 317 318 /* merge in the changes */ 319 apply_specdir(dir, root, parent, speconly); 320 321} 322 | 308 TIMER_RESULTS(start, "spec"); 309 if (fclose(fp) == EOF) 310 err(1, "Can't close `%s'", specfile); 311 312 /* perform some sanity checks */ 313 if (root == NULL) 314 errx(1, "Specfile `%s' did not contain a tree", specfile); 315 assert(strcmp(root->name, ".") == 0); 316 assert(root->type == F_DIR); 317 318 /* merge in the changes */ 319 apply_specdir(dir, root, parent, speconly); 320 321} 322 |
323static u_int 324nodetoino(u_int type) 325{ 326 327 switch (type) { 328 case F_BLOCK: 329 return S_IFBLK; 330 case F_CHAR: 331 return S_IFCHR; 332 case F_DIR: 333 return S_IFDIR; 334 case F_FIFO: 335 return S_IFIFO; 336 case F_FILE: 337 return S_IFREG; 338 case F_LINK: 339 return S_IFLNK; 340 case F_SOCK: 341 return S_IFSOCK; 342 default: 343 printf("unknown type %d", type); 344 abort(); 345 } 346 /* NOTREACHED */ 347} 348 349 | |
350static void 351apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly) 352{ 353 char path[MAXPATHLEN + 1]; 354 NODE *curnode; 355 fsnode *curfsnode; 356 357 assert(specnode != NULL); --- 357 unchanged lines hidden --- | 323static void 324apply_specdir(const char *dir, NODE *specnode, fsnode *dirnode, int speconly) 325{ 326 char path[MAXPATHLEN + 1]; 327 NODE *curnode; 328 fsnode *curfsnode; 329 330 assert(specnode != NULL); --- 357 unchanged lines hidden --- |