Deleted Added
full compact
fat.c (125469) fat.c (125471)
1/*
2 * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
3 * Copyright (c) 1995 Martin Husemann
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 21 unchanged lines hidden (view full) ---

30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33
34#include <sys/cdefs.h>
35#ifndef lint
36__RCSID("$NetBSD: fat.c,v 1.12 2000/10/10 20:24:52 is Exp $");
37static const char rcsid[] =
1/*
2 * Copyright (C) 1995, 1996, 1997 Wolfgang Solfrank
3 * Copyright (c) 1995 Martin Husemann
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 21 unchanged lines hidden (view full) ---

30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33
34#include <sys/cdefs.h>
35#ifndef lint
36__RCSID("$NetBSD: fat.c,v 1.12 2000/10/10 20:24:52 is Exp $");
37static const char rcsid[] =
38 "$FreeBSD: head/sbin/fsck_msdosfs/fat.c 125469 2004-02-05 06:32:16Z bde $";
38 "$FreeBSD: head/sbin/fsck_msdosfs/fat.c 125471 2004-02-05 06:55:12Z bde $";
39#endif /* not lint */
40
41#include <stdlib.h>
42#include <string.h>
43#include <ctype.h>
44#include <stdio.h>
45#include <unistd.h>
46
47#include "ext.h"
48#include "fsutil.h"
49
50static int checkclnum(struct bootblock *, int, cl_t, cl_t *);
51static int clustdiffer(cl_t, cl_t *, cl_t *, int);
52static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *);
53static int _readfat(int, struct bootblock *, int, u_char **);
54
39#endif /* not lint */
40
41#include <stdlib.h>
42#include <string.h>
43#include <ctype.h>
44#include <stdio.h>
45#include <unistd.h>
46
47#include "ext.h"
48#include "fsutil.h"
49
50static int checkclnum(struct bootblock *, int, cl_t, cl_t *);
51static int clustdiffer(cl_t, cl_t *, cl_t *, int);
52static int tryclear(struct bootblock *, struct fatEntry *, cl_t, cl_t *);
53static int _readfat(int, struct bootblock *, int, u_char **);
54
55/*-
56 * The first 2 FAT entries contain pseudo-cluster numbers with the following
57 * layout:
58 *
59 * 31...... ........ ........ .......0
60 * rrrr1111 11111111 11111111 mmmmmmmm FAT32 entry 0
61 * rrrrsh11 11111111 11111111 11111xxx FAT32 entry 1
62 *
63 * 11111111 mmmmmmmm FAT16 entry 0
64 * sh111111 11111xxx FAT16 entry 1
65 *
66 * r = reserved
67 * m = BPB media ID byte
68 * s = clean flag (1 = dismounted; 0 = still mounted)
69 * h = hard error flag (1 = ok; 0 = I/O error)
70 * x = any value ok
71 */
72
55int
56checkdirty(int fs, struct bootblock *boot)
57{
58 off_t off;
59 u_char *buffer;
60 int ret = 0;
61
62 if (boot->ClustMask == CLUST12_MASK)

--- 604 unchanged lines hidden ---
73int
74checkdirty(int fs, struct bootblock *boot)
75{
76 off_t off;
77 u_char *buffer;
78 int ret = 0;
79
80 if (boot->ClustMask == CLUST12_MASK)

--- 604 unchanged lines hidden ---