Commit Graph

6658 Commits

Author SHA1 Message Date
christos e37a2a9523 CID 1341561: Argument memory leak 2015-12-03 21:46:22 +00:00
christos 560e3b65f3 CID 1341560: Free arg. 2015-12-03 21:43:25 +00:00
christos 849ad1de81 CID 1341558: Fix proplib memory leaks 2015-12-03 21:40:32 +00:00
christos 0f11011500 CID 1341556: Don't leak map info 2015-12-03 21:30:54 +00:00
christos d293a8ecdb CID 1341548: Check error returns 2015-12-03 20:58:08 +00:00
christos 7c444fb990 compare to stdout, thanks kre 2015-12-03 04:39:41 +00:00
christos c7ec83db51 Add a space. 2015-12-03 02:16:00 +00:00
christos ba571ee20f Fix stray paste, noted by kre. 2015-12-03 02:09:20 +00:00
christos 5c1ccc6e9b WARNS=6 2015-12-03 02:02:43 +00:00
christos 621ecf3c5e remove extra assignment 2015-12-03 01:16:21 +00:00
christos da0a3b4c0b eliminate static globals so that commands can be re-used. 2015-12-03 01:07:28 +00:00
christos 54261dc52d - factor out into smaller separate functions
- fix signed/unsigned confusion
- do proper write checks
- fix some memory leaks
2015-12-02 22:32:04 +00:00
christos 73ff464c21 don't hard-code the program name 2015-12-02 20:42:07 +00:00
christos b62e64290c merge duplicated code and check allocations. 2015-12-02 20:41:10 +00:00
christos 2e738cf025 check allocations 2015-12-02 20:09:54 +00:00
christos 53de6040eb annotate map additions with non-allocated memory. 2015-12-02 20:09:33 +00:00
christos c458b37c6c - check errors from map allocation
- make map_resize return -1 instead of 0, and handle errors locally
  explaining what's going wrong
2015-12-02 20:01:44 +00:00
christos 2eda9128ae Allow backup and restore to operate on files. 2015-12-02 12:36:53 +00:00
christos 466f99a5ab don't advertise stuff we don't support. 2015-12-02 12:24:02 +00:00
christos ce4e8c4470 Always set NOSYNC if regular file, even if we got the size from the command
line.
2015-12-02 12:20:52 +00:00
jnemeth de2c104cf3 hrmm...
i386devel: {245} ./gpt add -b 1000 -s 1000 disk
Segmentation fault (core dumped)

Where's my flyswatter?   .......zzzzzzzap
2015-12-02 11:20:34 +00:00
jnemeth 777094fd12 - dereferencing NULL is generally bad, found by visual inspection
- automatically set nosync when opening a file to avoid spurious errors
2015-12-02 10:19:58 +00:00
christos 272fa82935 print the old and the new style usage. 2015-12-02 04:17:25 +00:00
christos cdf86847f5 refactor the utf code so that it does not leak memory. 2015-12-02 04:07:11 +00:00
christos d1f209293e split out into smaller functions. 2015-12-02 04:06:47 +00:00
christos c94670c3be use the utility function. 2015-12-02 04:06:10 +00:00
christos b732231137 - write a function to set the entity, so that we don't reset to guid.
- entry 0 means create entry.
2015-12-02 01:01:55 +00:00
pgoyette a1258c3a17 By default, don't display the module load address. Add a -k option
to restore display of this field.
2015-12-02 00:56:09 +00:00
christos 0f004afe33 merge command line parsers and check all memory allocations. 2015-12-01 23:29:07 +00:00
christos 1c8d6ff1b4 Reflect reality better; we don't handle multiple devices anymore, and
the partitions option is only for the commands that support it.
2015-12-01 22:49:25 +00:00
christos bbb4a8ab26 refactor more duplicated code. 2015-12-01 19:25:24 +00:00
christos 6fb89396f8 automatically enforce readonly for the commands that don't need to write. 2015-12-01 16:33:55 +00:00
christos 8ca93e4658 Refactor the command dispatching and help printing logic. 2015-12-01 16:32:19 +00:00
christos 0b43d398b9 Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.
2015-12-01 09:05:33 +00:00
christos 68bc3825b8 - use gpt_msg to print informational messages (perhaps these should be printed
only with -v)
- don't print any messages with gpt_msg if quiet
- print a message if we didn't reconfigure the wedges
2015-12-01 02:03:55 +00:00
christos 835e6be8c3 only update the wedge information if it is supported. 2015-12-01 01:49:23 +00:00
christos e4ed2565fe - automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.
2015-11-30 19:59:34 +00:00
wiz 634690fb1c Fix xref. 2015-11-29 21:36:35 +00:00
christos 7e254cfb82 Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).
2015-11-29 15:32:46 +00:00
christos 2d178fa50d Add the missing cases. 2015-11-29 14:12:56 +00:00
christos 4ab2c2d9c7 Add some debugging. 2015-11-29 14:12:35 +00:00
christos c313281022 Do division once 2015-11-29 14:03:35 +00:00
christos f8906ab68d Only use the ioctl's if we have them. 2015-11-29 13:46:23 +00:00
jnemeth 1ca10bc795 fix build breakage for systems that do not have DIOCG{SECTOR,MEDIA}SIZE 2015-11-29 13:24:28 +00:00
christos 2599c179cc print the current map type. 2015-11-29 00:34:39 +00:00
christos 5435e55eab - use snprintf
- fix bogus logic on map_type
2015-11-29 00:15:12 +00:00
christos ca4e0dcdd1 merge the create errors in one place and fix them. 2015-11-29 00:14:46 +00:00
pgoyette e6045f6364 Add cross-refs from modload(8) amd modunload(8) to modctl(2) 2015-11-28 23:53:48 +00:00
christos 35da36c439 CID 1340063: fix TOCTOU 2015-11-24 14:07:18 +00:00
christos fc8a4870ed Don't chdir to the config directory; just form the parameters file with a
path if needed.
2015-11-22 20:24:19 +00:00
christos cd40e75014 explain how to clear an entry (without reading the source) 2015-11-22 15:53:10 +00:00
christos d59d77037c - update NAME_MAX to match the kernel.
- add a comment about where the constant is used.
2015-11-16 17:06:47 +00:00
jnemeth 6141a178e3 correctly print the gpt header revision as a "float" 2015-11-16 12:24:13 +00:00
tnn c9f8274c3f fix iSCSI RFC number 2015-11-10 12:41:18 +00:00
christos 51068fec25 print flags symbolically. 2015-11-04 16:04:55 +00:00
ozaki-r c2e5d2b795 Fix rump.ping6 -c N (N > 1) doesn't work
2nd packet and subsequent packets are sent based on SIGALRM and
it depends on poll(2) returns with EINTR by the signal. However,
currently poll is rump-ified while signals aren't so the signal
doesn't wake up poll and ping6 doesn't work expectedly.

Rump-ifying signals is unsure (nobody does it for now) and the
combination use of signals and poll makes the logic a bit complex.
So let's fix the defect by stopping using signals for packet
transmissions. The new logic is derived from ping(8).

Bonus: ping6 -i 0.01 works as we expect now while the original
didn't work enough fast.
2015-11-04 08:07:54 +00:00
ozaki-r c94323a777 Fix exit status when -c and -X is used
It exited with status 0 when at least one packet was received
and timed out. However, when we specify -c N (while N > 0),
we expect that it fails if it times out before all sent requests
are replied.
2015-11-04 07:59:25 +00:00
pgoyette b6f71a3653 Add FLAGS to the module data displayed. Reduce some of the extra
inter-column white-space to (partly) compensate for the additional
column.
2015-11-04 04:30:42 +00:00
knakahara fad49cfc60 rump.ping6 supports "-S" option. 2015-11-04 01:14:02 +00:00
jnemeth 902aecab13 Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.
2015-11-03 02:19:24 +00:00
christos 1428ec3f79 remove advertising clause. 2015-10-16 17:38:17 +00:00
dholland 6ada0ed75b Teach scan_ffs about lfs64.
(and also about byte-swapped lfs volumes, which might or might not
actually work)
2015-10-15 06:25:23 +00:00
dholland 06de5f4e56 Make dump recognize lfs64.
For now at least it will refuse to touch it though as it needs to be
taught more abstraction about directory entries; currently it blindly
uses struct direct from ffs and will croak on the lfs64 64-bit inode
numbers.
2015-10-15 06:25:12 +00:00
dholland ae64c38ebb Enable lfs64 in fsck_lfs.
(and in everything else that uses this code)
2015-10-15 06:24:55 +00:00
dholland 511153d2cc Enable the creation of lfs64 volumes.
To create an lfs64 volume, use -w 64. You can also force a 32-bit
volume with -w 32, but this will fail on devices thta are too large.

lfs64 is the default for devices > 1TB. (1TB rather than 2TB because
daddr_t is signed and negative block numbers can cause interesting
complications.)

For now print a warning that the lfs64 format isn't finalized, because
it isn't. For now any lfs64 use should be limited to test data,
benchmarking, and so forth.
2015-10-15 06:24:33 +00:00
christos fec59bb419 these are syslog-like 2015-10-14 15:53:24 +00:00
mrg 28d34520d5 don't stop processing /etc/fstab when one entry fails, both for
add and remove loops.  now when you add a new swap file and run
"swapctl -A" it won't give up after the existing one gives EBUSY
and move on to the rest.
2015-10-11 23:58:16 +00:00
dholland 0a6370d92e Use a specific SEGSUM size instead of the size of the union. 2015-10-10 22:34:19 +00:00
dholland f3729261c1 Track down and fix two missing uses of SEGSUM_FINFOBASE(). 2015-10-10 22:34:09 +00:00
dholland da7186290f The per-inode state 'id_entryno' is used by pass1 for a block count,
so widen it to 'long long'. pass2 uses it for the number of entries in
a directory (IIUC) which does not need to be wider than int, but for
now let's not try to split into two fields. FUTURE...
2015-10-03 08:30:13 +00:00
dholland a07fd0a2a2 Use daddr_t instead of uint32_t for the in-memory copy of the inode
block pointers.
2015-10-03 08:30:02 +00:00
dholland 896006c986 Drop an explicit sign-extension in fsck that shouldn't be needed any
more.
2015-10-03 08:29:48 +00:00
dholland 93f2a7d5e8 Add lfs_checkword type for reading checksum data out of structures.
This is always uint32_t, but having a name for it both makes things
clearer and avoids confusion about whether it should be 32 or 64 bit.

Note: deployed in only one place (that was erroneously tagged
ondisk32) so far.
2015-10-03 08:29:34 +00:00
dholland db7a6054ae Fix hardwired 32-bit stuff in fsck:
- compute the maximum file size using LFS_BLKPTRSIZE()
   - use the new IINFO in pass 6 instead of uint32_t pointers
   - use accessors to read and write indirect blocks
2015-10-03 08:29:21 +00:00
dholland b82b54bc04 Remove a dead data structure. 2015-10-03 08:29:06 +00:00
dholland 7f7a5fa1e3 Apply IINFO in the other userland tools. 2015-10-03 08:28:46 +00:00
dholland a407c8d218 Use IINFO in lfs_writeinode().
(both the kernel and the userland copies)
2015-10-03 08:28:15 +00:00
mrg 710e06c668 add smart IDs 210, 246, 247 and 248 (Micron):
+       { 210,          "Successful RAIN Recovery Count", NULL },
+       { 246,          "Total Host Sector Writes", NULL },
+       { 247,          "Contact Factory (Micron)", NULL },
+       { 248,          "Contact Factory (Micron)", NULL },

(eek i hope 247 and 248 don't move.)
2015-09-21 06:05:00 +00:00
dholland cfe9c0210f Fix some assorted 32-bit assumptions not yet otherwise handled.
Also apply patch to fix the overt problem in PR 50246: newfs was
calculating ifpb wrong for volumes with non-default block sizes.
2015-09-21 01:24:58 +00:00
dholland 947343ea0e Add 64-bit directory entry structures, and adjust accessors accordingly.
The LFS64 directory entry has a 64-bit inode number. This is stored as
two 32-bit values to avoid inducing 64-bit alignment requirements.

The exposed type for manipulating directory entries is now
LFS_DIRHEADER, following the same convention as e.g. IFILE and SEGUSE.
(But with LFS_ on it, because.)
2015-09-21 01:24:23 +00:00
dholland 80201f5aa5 Oops; LFS_DIRECTSIZ() is going to need the fs as an argument.
Also, it turns out that dirhash needs a compile-time-constant version
of LFS_DIRECTSIZ(LFS_MAXNAMLEN+1), independent of 64-vs-32, so create
LFS_MAXDIRENTRYSIZE for this. Sigh.
2015-09-21 01:22:18 +00:00
dholland 75caa729bb Clean up struct lfs_dirtemplate. 2015-09-20 04:51:43 +00:00
dholland 805a8504cb Pass around struct lfs_dirheader instead of struct lfs_direct. 2015-09-15 15:02:25 +00:00
dholland 98320dbc87 Add an accessor function for directory names. 2015-09-15 15:02:01 +00:00
dholland 653d6346b1 Add a function lfs_copydirname() to copy directory names in place; use
it in place of (variously) memcpy and strlcpy. (The latter isn't even
correct; was probably changed blindly from strncpy at some point.)

The new function zeroes the padding in the directory entry instead of
leaving trash behind.
2015-09-15 15:01:38 +00:00
dholland 06be19e226 Tidyups/fixes preparatory to making d_name[] in struct lfs_direct size
0 instead of size LFS_MAXNAMLEN+1, and preparatory to having accessor
functions for d_name. In particular, don't create prototype entries
and copy them, and access the name field only for directory structures
that are in buffers with space for the name to exist.
2015-09-15 15:01:22 +00:00
dholland c2c4048b2d Move the header part of struct lfs_direct to its own structure.
(lfs_dirheader)

Take the opportunity to improve the directory generation code in
make_lfs.c. (Everything else was unaffected by virtue of using
accessor functions.)
2015-09-15 14:59:58 +00:00
dholland 5a97d9e5b6 Add and use accessor functions for more of the directory entry fields. 2015-09-15 14:58:05 +00:00
ozaki-r 44996ea918 Include a few additional libc functions in rump.route to make it work with inet6
getaddrinfo and if_nametoindex are newly added to interpret interface names
in IPv6 link-local addresses. if_nametoindex looks not used in rump.route,
but it is needed because it is used indirectly from getaddrinfo.

From s-yamaguchi@IIJ
2015-09-14 05:12:52 +00:00
christos 8730816515 more recent information about unsupported drives. 2015-09-09 11:14:09 +00:00
ozaki-r 0cea365c35 Include several libc functions in rump.ping6
We need getaddrinfo, getifaddrs, if_indextoname and if_nametoindex
in addition to getnameinfo.
2015-09-09 10:06:05 +00:00
bad 6c69384dad Rename argument of rf_output_devname() from devname to name to avoid a
warning about shadowing a global symbol when compiled by buildrump.sh.
Discussed with mrg.
2015-09-08 08:59:09 +00:00
mlelstv 733f23562f A change to the GPT_TYPE list also requires a change to the GPT_TYPE
index constants.
2015-09-04 17:59:53 +00:00
dholland ec175d5025 Add new accessors for the d_type and d_namlen fields of struct lfs_direct.
Napalm the old byteswap access logic for these.
2015-09-01 06:16:58 +00:00
dholland 5f1180cf85 Remove ulfs_daddr_t. 2015-09-01 06:15:16 +00:00
dholland 08dc10dc96 Use daddr_t, not ulfs_daddr_t, as the latter's 32 bits wide.
Don't use either for on-disk items.
Declare external data in header files.
Part 3 of 3.
2015-09-01 06:15:02 +00:00
dholland 481db95097 Use daddr_t, not ulfs_daddr_t, as the latter's 32 bits wide.
Don't use either for on-disk items.
Part 2 of 3.
2015-09-01 06:13:57 +00:00
dholland dfb99dfd3e Use daddr_t, not ulfs_daddr_t, as the latter's 32 bits wide.
Don't use either for on-disk items.
Part 1 of 3.
2015-09-01 06:13:33 +00:00
dholland 30c3aa6e8a Tidy the MAXSYMLINKLEN macros. 2015-09-01 06:12:33 +00:00
dholland eb2560adae The ifile's inode number is constant. (it is always 1)
Therefore, storing the value in the superblock and reading it out
again is silly and offers the opportunity for it to become corrupted.
So, don't do that (most of the code already didn't) and use the
existing constant instead. Initialize new 32-bit superblocks with
the value for the sake of old userland programs, but don't keep the
value in the 64-bit superblock at all.

(approved by Margo Seltzer)
2015-09-01 06:12:04 +00:00
dholland 4b344787e1 Make the inode fields in the 64-bit superblock 64 bits wide.
Reasoning as before.

Note that I am not going through and checking for 64->32 truncations
in inode numbers; I'm sure there are quite a few, but that's a project
for later.
2015-09-01 06:11:06 +00:00
dholland 4d398b859d Add byteswapping to the dinode accessors.
This prevents regressions in the ulfs code when switching to the new
accessors. Note that while adding byteswapping to the other accessors
is straightforward, I haven't done it yet; and that also is not enough
to make LFS_EI work, because there are places lying around that bypass
the accessors for one reason and another and all of them need to be
updated. That is going to have to wait for a later day as LFS_EI is
not on the critical path right now.
2015-09-01 06:10:16 +00:00
dholland da32f22c2a Use the lfs dinode accessors in place of the ufs-derived ones.
(Mostly.)

The ufs-derived ones are fake structure member macros, which are gross
and not very safe. Also, it seems that a lot of places in the lfs code
were using the ffsv1 branch of them unconditionally, and this way it's
guaranteed all those places have been updated.

Found while doing this: for non-devices, have getattr produce NODEV
in the rdev field instead of leaking the address of the first direct
block.
2015-09-01 06:08:37 +00:00
jnemeth 8eaf165929 update client OS version as well 2015-08-30 10:49:57 +00:00
jnemeth aca6703611 PR/49616 - Andreas Gustafsson -- bring modload example into era of MODULAR 2015-08-30 10:46:52 +00:00
mlelstv 77d8bce2f4 Calculate sector size from superblock and use that instead of DEV_BSIZE. 2015-08-30 05:23:17 +00:00
mlelstv 6e7966e6f5 Use getfsspecname also when not found in /etc/fstab. 2015-08-26 05:41:20 +00:00
bouyer 2266c911f6 Consistently use iswap64() and 64bit intermediate variable, as well as
64bit formats for c_tapea. Fixes tape useage report for large filesystems.
2015-08-24 17:37:10 +00:00
bouyer 262ce6cb8d Default the read block size (-k default value) to kern.maxphys (usually
64k these days). This gives a noticable performance boost on large filesystems.
2015-08-24 17:34:03 +00:00
christos cf0ea7fe31 swap the formats too, not just the args. 2015-08-23 16:00:23 +00:00
dholland 336a1ae812 Fix reversed arguments to a print. nice and confusing... 2015-08-23 09:29:46 +00:00
dholland c9cfc4bd98 Part two of dinodes; use the same union everywhere.
(previously the ufs-derived code had things set up slightly different)

Remove a bunch of associated mess.
2015-08-19 20:33:29 +00:00
knakahara 84f76c9c0f Add intrctl(8). 2015-08-17 06:42:45 +00:00
dholland b1828e0ba3 Hack up dinode usage to be 64 vs. 32 as needed. Part 1.
(This part changes the native lfs code; the ufs-derived code already
has 64 vs. 32 logic, but as aspects of it are unsafe, and don't
entirely interoperate cleanly with the lfs 64/32 stuff, pass 2 will be
rehashing that.)
2015-08-12 18:28:00 +00:00
dholland e54b457c15 Provide 32-bit and 64-bit versions of FINFO.
This also entailed sorting out part of struct segment, as that
contains a pointer into the current FINFO data.
2015-08-12 18:27:01 +00:00
dholland 2e090556c4 Make 32-bit and 64-bit versions of SEGSUM.
Also fix some of the FINFO handling as it's closely entangled.
2015-08-12 18:26:26 +00:00
dholland 32577c4f1c Add IFILE32 and IFILE64 structures for the on-disk ifile entries.
Add and use accessors. There are also a bunch of places that cast and
I hope I've found them all...
2015-08-12 18:25:51 +00:00
dholland f11e4edeba Make 32-bit and 64-bit versions of CLEANERINFO.
XXX: while this is written to disk, it seems like much of it would
XXX: be better set up as a commpage shared with the cleaner.
2015-08-12 18:25:03 +00:00
mrg d7c39481bd add an example for rescanning ATA busses. 2015-08-08 07:52:52 +00:00
ozaki-r 2a4e5e0f61 Introduce rump.ping6
We use ping6 frequently in ATF tests so let's have rump-ified one.
2015-08-06 14:45:54 +00:00
dholland 076dce6286 Use intmax_t to print daddr_t; from sevan@. 2015-08-03 04:16:10 +00:00
dholland 9e5184b86b Add a (draft) 64-bit superblock. Make things build again.
Add pieces of support for using both superblock types where
convenient, and specifically to the superblock accessors, but don't
actually enable it anywhere.

First substantive step on PR 50000.
2015-08-02 18:18:09 +00:00
dholland 992b9a23af Use accessor functions for the version field of the lfs superblock.
I thought at first maybe the cases that test the version should be
rolled into the accessors, but on the whole I think the conclusion on
that is no.
2015-08-02 18:14:16 +00:00
dholland 31c72b56c0 Don't include ufs headers. 2015-08-02 18:12:18 +00:00
dholland 9263edc766 Use the lfs header file and lfs's mount args struct, not ufsmount.h
and the ffs mount args struct, for mounting lfs.

(they are the same, so this doesn't matter yet, but still...)
2015-08-02 18:11:57 +00:00
dholland ae8b3536ce Typo in comment. 2015-08-02 18:11:36 +00:00
dholland eed9c32288 Use c99 initializers. 2015-08-02 18:11:12 +00:00
dholland 078ffcb8d8 Second batch of 64 -> 32 truncations in lfs, along with more minor
tidyups and corrections in passing.
2015-08-02 18:10:07 +00:00
dholland 95a8d28c27 Fix assorted 64 -> 32 truncations in lfs. Also, some minor tidyups and
corrections in passing.
2015-08-02 18:08:12 +00:00
dholland af0d133055 Fix bug: for format version 1, the superblock "size" field is measured
in blocks instead of frags, so use lfs_blkstofrags to correct it.

This code was instead multiplying by the block size divided by
DEV_BSIZE to get the number of disk blocks rather than the number of
frags. (I gather that originally these were the same, but they're not
necessarily any more.)
2015-08-02 17:56:24 +00:00
ozaki-r e32e871503 Don't divide flags output
If there are many enabled flags, ifconfig divides flags output into
multiple formatted strings due to snprintb_m, e.g.,
  wm0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX>wm0: flags=8b43<MULTICAST> mtu 1500

This behavior is probably unexpected. The change always outputs enabled
flags at once like this:
  wm0: flags=8b43<UP,BROADCAST,RUNNING,PROMISC,ALLMULTI,SIMPLEX,MULTICAST> mtu 1500
2015-07-29 07:42:27 +00:00
dholland 34f0d74c9e Add a new lfs header file: lfs_accessors.h.
This contains all the accessor functions and macros out of lfs.h.
Add an include of lfs_accessors.h after all uses of lfs.h... except
for code that wants to define its own struct lfs-alike that the
accessors are supposed to play along with. For these, set STRUCT_LFS
and include lfs_accessors.h after the necessary structure has been
defined, so that lfs_accessors.h can emit functions in terms of it.
2015-07-28 05:09:34 +00:00
mlelstv 1cd8415fdc Handle getfsspecname errors. 2015-07-25 10:37:22 +00:00
dholland adca8af59e More lfs superblock accessors.
(This changes the rest of the code over; all the accessors were
already added.)

The difference between this commit and the previous one is arbitrary,
but the previous one passed the regression tests on its own so I'm
keeping it separate to help with any bisections that might be needed
in the future.
2015-07-24 06:59:31 +00:00
dholland f59b8f4b3a Switch to accessor functions for elements of the LFS on-disk
superblock. This will allow switching between 32/64 bit forms on the
fly; it will also allow handling LFS_EI reasonably tidily. (That
currently doesn't work on the superblock.)

It also gets rid of cpp abuse in the form of fake structure member
macros.

Also, instead of doing sleep/wakeup on &lfs_avail and &lfs_nextseg
inside the on-disk superblock, add extra elements to the in-memory
struct lfs for this. (XXX: these should be changed to condvars, but
not right now)

XXX: this migrates a structure needed by the lfs code in libsa (struct
salfs) into lfs.h, where it doesn't belong, but for the time being
this is necessary in order to allow the accessors (and the various
lfs macros and other goop that relies on them) to compile.
2015-07-24 06:56:41 +00:00
mrg ec5f69b6a6 convert "component*" into "absent" for "START disks" part of the
output from "raidctl -G".  now this actually works when fed back
into raidctl -[cC].
2015-07-21 05:54:44 +00:00
htodd 7f6bcf1f58 Fix build. 2015-07-18 06:00:46 +00:00
tsutsui 1d2382733b Fix botch in "make disklabel a MI tool" changes in rev 1.2.
After that chanage, "MAXPARTITIONS" constant is not for the target port.
If host's MAXPARTITIONS is larger than a value of the target label and
target endianness is different from the build host, bswaplabel() could
overwrite data beyond the disklabel and primary boot stored after
LABELSECTOR in images might be corrupted.

This fixes boot failure of sun2 liveimage built by
"build.sh -U -m sun2 release live-image"
on TME.

Should be pulled up to netbsd-7.
2015-07-17 20:30:21 +00:00
wiz e485731cb1 Bump date for previous. Add whitespace.
Fix some mandoc warnings.
2015-06-30 22:16:12 +00:00
sborrill 9a9013c60c Clarify that what was previously known as -A root is now -A forceroot, not
-A softroot and that -A root can still be used for historical reasons.
2015-06-30 17:18:13 +00:00
sborrill 06ac39463d Compare correct length string for force option to -A 2015-06-30 17:02:14 +00:00
manu 123566befd Remove useless and harmful sync(2) call in umount(8)
Remove sync(2) call before unmount(2) in umount(8). This sync(2) is useless
since unmount(2) will perform a VFS_SYNC anyway.

But moreover, this sync(2) may be harmful, as there are some situation where
it cannot return (unreachable NFS server, for instance), causing umount -f
to be uneffective.
2015-06-27 08:29:56 +00:00
pooka 8da4f44455 &stars[offset] -> stars+offset. It's shorter!
Coincidentally, the change also works around a gcc 5.1 bug which causes
a segmentation fault when trying to compile the longer version (guess
the compiler got exhausted, or something).
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66345
2015-06-26 01:16:54 +00:00
dholland 49f4cf4b46 Add used-by comments on source files that are .PATH'd in from elsewhere. 2015-06-21 04:01:40 +00:00
dholland c30abfbbfa global variables should be declared extern. 2015-06-21 03:58:36 +00:00
dholland 68072c6ae8 add missing rcsid 2015-06-21 03:33:22 +00:00
jnemeth 29c769ab8c Instruct user to use resizedisk if media size has changed, as
resizedisk will adjust the media size in the headers, whereas
recover simply copies the existing header over the missing one.

XXX recover and resizedisk should probably be merged (even if just
partially, so that recover can properly handle media size changes).
Also, reading in the GPT should probably be centralised so that
error handling can be centralised, and users aren't given misleading
messages (i.e. they aren't told to run recover when they should be
running resizedisk).  However, something that can be quickly pulled
up to netbsd-7 was needed, and there isn't time for a major overhaul
or rewrite.
2015-06-18 01:37:23 +00:00
christos 16cbeecd24 add missing ; 2015-06-17 00:18:35 +00:00
christos 5bf62a09d2 a few more \n's in errors 2015-06-16 23:58:30 +00:00
christos d3037dba83 fix error messages containing \n 2015-06-16 23:18:54 +00:00
martin 80e8cba3b7 Make querying the disk geometry fail silently if called for a non-exitent
disk.
XXX: DIOCGDISKINFO returns strange error codes
2015-06-03 17:53:23 +00:00
matt 5f53a93d2f Use the new BRDGGIFS and BRDGRTS cmds which just use ifdrv directly. 2015-06-01 06:15:18 +00:00
hannken c063d4ccd5 Use VFS_PROTOS() for lfs.
Rename conflicting struct lfs field "lfs_start" to "lfs_s0addr".

No functional change.
2015-05-31 15:44:30 +00:00
joerg e85ef03b1e Remove ISCSI_DEBUG branches. 2015-05-30 16:00:51 +00:00
joerg 44f0e14601 Remove userland side of ISCSI_DEBUG and ISCSI_TEST_MODE. 2015-05-30 15:57:32 +00:00
joerg d8413b896e constness doesn't increase by applying more const. 2015-05-28 20:14:00 +00:00
matt c142b6df31 Constify an array of strings. 2015-05-28 01:35:31 +00:00
christos e304a25c5b use strtou 2015-05-27 17:55:23 +00:00
manu 05c0668e69 Better sanity check numbers given to raidctl(8)
Replace atoi(3) by strtol(3), and check that numbers are valid,
positive, and in int32_t range. The previous lack of check could
silently lead to the same serial being set to all RAID volumes
for instance because given numbers were bigger than INT_MAX. The
consequence is in an awful mess when RAIDframe would mix volumes...
2015-05-27 15:31:15 +00:00
ozaki-r 44b264d7a7 Fix rump.ifconfig shows host's interface names in link local addresses 2015-05-19 08:14:38 +00:00
kefren 0c4c07ab30 Add options -X for deadline and -x for reply maxwait (flag names matching
FreeBSD). Unline FreeBSD, currently -x doesn't count late packets to statistics.
After discussion with, and help from ozaki-r@
Should fix PR/49896
2015-05-15 08:02:39 +00:00
ozaki-r 6011d36bd6 Fix rump.{netstat,route} shows host's interface names in link local addresses
Interface names of IPv6 link local addresses are resolved
by getnameinfo(3). So we need to rump-ify it as well as
if_indextoname and getifaddrs.
2015-05-15 06:58:59 +00:00
mlelstv 1490a7ba80 Add documentation for the drvctl driver and add reference.
Fixes PR 49895.
2015-05-13 07:28:49 +00:00
roy e0cc834e99 ioctl -> prog_ioctl as pointed out by pooka@ 2015-05-12 14:05:29 +00:00
pgoyette 77cc846abe Use _PATH_WATCHDOG from <paths.h> instead of locally-defined value. 2015-05-06 23:08:30 +00:00
roy dbb6db0ed0 Report IN_IFF_TENTATIVE and friends.
Wait for IN_IFF_TENTATIVE to be removed with the -w flag.
2015-05-02 14:43:51 +00:00
christos 874b0026ee Add missing doc flags (B,M,m) 2015-04-29 17:07:11 +00:00
christos c4603cb30b - use calloc to zero memory
- pass the proper buffer to mkdir
- fix for apple ufs
2015-04-29 01:49:25 +00:00
christos 4f6ce6a7d2 reduce bss usage 2015-04-28 15:15:53 +00:00
christos d5a931670f remove 80211 stats if small. 2015-04-28 15:14:57 +00:00
prlw1 9521ae7bfd Fix typos 2015-04-28 09:48:30 +00:00
christos c902c296d4 fix mistake in previous 2015-04-27 17:05:58 +00:00
maxv 3220cb2ac6 Be a bit more verbose if the kernel rejects a file 2015-04-26 09:20:09 +00:00
christos 74c7e628de make table smaller in size. 2015-04-25 21:43:53 +00:00
christos 8e83ba138f Add the once -o option like ping 2015-04-24 00:42:56 +00:00
abs b46e0d1534 newfs_msdos allowed suffixes such as 'k', 'm' for some parameters,
but amusingly this did not include Block size, or Sectors per cluster.
Allow for all numeric parameters (If I want to specify the number
of drive heads as '1K', then why not?)
2015-04-23 13:27:14 +00:00
roy a7a37fb042 Move the INET6 specific code for wait_dad_exec() into af_inet6
by using a new afswtch hook af_addr_tentative.
2015-04-22 17:42:22 +00:00
ozaki-r df66dd74ee Fix rump.route shows host's interface names
Let it use rump-ified if_indextoname and getifaddrs
to get rump kernel's interfaces, which is the same way
as ifconfig.
2015-04-22 03:07:55 +00:00
mrg 2603e0673f remove various HAVE_GCC=45 fragments. 2015-04-15 19:13:46 +00:00
riastradh db8ca554ec Use <sys/rndio.h> instead of <sys/rnd.h>. 2015-04-13 22:18:50 +00:00
jmcneill d0b93bc844 if the -p flag is specified, display a progress bar while growing the file-system 2015-04-06 22:44:04 +00:00
mlelstv f3a445024e factor out geometry calculation and use this also in CheckOnly mode.
be a bit more verbose in Verbose mode.
2015-04-06 13:33:42 +00:00
mlelstv 4962b364b8 Handle case in grow() where last cylinder group is too small for ufs2.
Align with code in shrink().
2015-04-06 12:38:21 +00:00
wiz 5a1645e4da New sentence, new line. Sort option descriptions. 2015-03-29 19:42:15 +00:00
chopps f89312b935 - Fix fallout for recent bread() change (removing cred arg). 2015-03-29 19:35:58 +00:00
chopps ae3fcf098a - Add -c to check to see if grow/shrink is required
- Divide by DEV_BSIZE when returning size of file.
- Update manpage
2015-03-29 19:33:55 +00:00
riastradh 9ea98f4524 Use `!= -1' instead of `== 0' out of paranoia. 2015-03-28 17:25:33 +00:00
riastradh bb5cf371be Make get_dev_size work on regular files too. 2015-03-28 17:22:46 +00:00
roy a37502b2b6 Add RTF_BROADCAST to mark routes used for the broadcast address when
they are created on the fly. This makes it clear what the route is for
and allows an optimisation in ip_output() by avoiding a call to
in_broadcast() because most of the time we do talk to a host.
It also avoids a needless allocation for the storage of llinfo_arp and
thus vanishes from arp(8) - it showed as incomplete anyway so this
is a nice side effect.

Guard against this and routes marked with RTF_BLACKHOLE in
ip_fastforward().
While here, guard against routes marked with RTF_BLACKHOLE in
ip6_fastforward().
RTF_BROADCAST is IPv4 only, so don't bother checking that here.
2015-03-23 18:33:17 +00:00
enami c1e351a1b2 Don't truncate at microseconds while preserving timestamps.
One of motivation of this change is to make the behavior of test(1)
-nt/ot with preserved copy (like cp -p) closer to the NetBSD 6.
Of course whether full timestamps are kept or not depends also on
underlying file system.

The ifdef added in mv(1) since existing ifdefs was our local change
to compile it on solaris (though I couldn't test it):
http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html
2015-03-02 03:17:24 +00:00
mlelstv 4b8999e0dd safely update existing wedge links 2015-03-01 14:21:17 +00:00
roy 43800a7e73 Teach route(8) about RTF_LOCAL. 2015-02-26 09:56:11 +00:00
wiz 2122be46d6 Bump date for previous.
New sentence, new line.
2015-02-25 09:01:08 +00:00
mlelstv 0a7f816b6d Let drvctl -p select elements from an array property by numeric index. 2015-02-24 18:15:29 +00:00
joerg a39ebfb79e Move communication socket to /var/run, especially when starting iscsid
during boot, it might disappear otherwise.
2015-02-21 20:33:44 +00:00
christos 3d6eb1fc0f let's make this compile again. 2015-02-15 21:46:49 +00:00
jmcneill 481b9e731c At startup, instead of doing run-hooks for each device, call run-hooks
once with a list of all found devices. This lets us batch calls to MAKEDEV
which results in a noticeable improvement in Raspberry Pi boot time.

Run the initial device enumeration hooks before detaching from the foreground,
ensuring that any required devices have been created before the rc.d script
exits.
2015-02-15 15:56:30 +00:00
roy 9fbc750691 Display the IPv6 address flags autoconf and temporary 2015-01-20 22:13:19 +00:00
christos a451832ee3 kill 1 copy of strtonum. 2015-01-16 20:12:28 +00:00
christos 20d9dd5566 make netname4 match the netname6 signature avoiding a NULL pointer. 2015-01-07 22:38:32 +00:00
msaitoh 27d20d98fc Add missing "addr" and "static" commands. 2015-01-05 00:36:23 +00:00
pooka 15c9a10afd gcc 4.9 produces vfork clobberation warnings for "name" and "buflen".
Since there's no performance reason to use vfork here, just replace it
with fork and be done with warnings once and for all.
2015-01-04 22:05:37 +00:00
reinoud 4897154dae Fix volumesetname to comply to UDF 2.01 [2.2.2.5] 2015-01-02 21:01:12 +00:00
christos 52e8eb1316 Fix the 3 programs that use DTYPE_ (disklabel disk types) constants from the
kernel. Two of them are inside ifdefs.
2015-01-02 19:46:02 +00:00
mlelstv d15e4a5d5d Avoid mixing cluster numbers and sector numbers. Makes code more readable. 2015-01-02 06:21:28 +00:00
christos 15f5b75638 abort earlier. 2014-12-29 16:35:38 +00:00
christos 59069b7aab Provide a simple getdisksize() api for gpt(8). 2014-12-29 16:27:43 +00:00
christos ccbdb0d177 Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.
2014-12-29 16:27:06 +00:00
prlw1 f44489f8dc MKINET6=no build fixes
http://mail-index.netbsd.org/tech-net/2014/12/13/msg004898.html
2014-12-20 13:15:48 +00:00
roy 62cbe5902e Note that RTM_CHANGE can also change the gateway 2014-12-17 10:56:09 +00:00
christos d980f336d5 fix possibly uninitialized variable. 2014-12-14 23:27:14 +00:00
christos d4b702a5f2 avoid local variable shadowing devname. 2014-12-14 23:25:07 +00:00
wiz b1ec4779e4 Bump date for previous. Fix typo. 2014-12-14 17:15:14 +00:00
mlelstv a0b59f5f8a Add validation methods "mbr" and "gpt" for disks without a valid disklabel. 2014-12-14 12:31:39 +00:00
mlelstv f902d9ca42 support wedge names.
The default param file for a wedge is still named after the device (dkN)
which might be unpredictable. Use an explicit param file instead.
2014-12-14 11:31:39 +00:00
mlelstv 490457d5da Make ccdconfig resolve wedge names. 2014-12-07 10:44:34 +00:00
mlelstv 9171ddc6ae Fix handling of -t option for the type command.
Match any type, when no option is given, just like for the label command.
2014-12-07 09:51:42 +00:00
wiz d12dcb884c Bump date for previous. 2014-12-06 21:53:55 +00:00
mlelstv c3505b64dc Add some more common partition types. 2014-12-06 12:24:22 +00:00
mbalmer 89b27dd856 Add reference to mount_chfs, bump date. 2014-12-06 12:12:17 +00:00
christos 3747949d9f Instead of zerodivide, give a useful error message. 2014-12-04 01:41:37 +00:00
christos 27fad02cd4 Complete the routing argument table by including the ID's used in the routing
display.
2014-12-01 20:30:27 +00:00
christos b5ac626c87 Adjust default packet size to 56 data bytes (64 total).
Make error messages consistent.
2014-11-29 14:48:42 +00:00
christos 0c4052c0de PR/49423: Martin Husemann: ping for small packets does not work in -7 or
-current
XXX: pullup 7?
2014-11-27 19:43:58 +00:00
christos aeb66be189 - pass the proper argument vector so that subcommands can use getopt.
- add -q and -e for listwedges.
2014-11-23 15:43:49 +00:00
mlelstv 96f40a63cc handle constness better 2014-11-17 07:15:28 +00:00
mlelstv 477be5f2de handle constness 2014-11-17 07:13:42 +00:00
mlelstv 8e3b364b00 Report the argument instead of (null) when opendisk fails. 2014-11-17 07:11:18 +00:00
joerg c87c6690c0 Skip vendor if the string is empty. 2014-11-15 01:52:01 +00:00
christos 2bd97efc9a PR/47704: Takahiro HAYASHI: Add -L flag 2014-11-12 03:34:08 +00:00
christos 802a4e04fc remove debugging 2014-11-09 22:50:38 +00:00
christos 66d4eaa769 add handler for /kern/evcnt and print the actual error when failing. 2014-11-09 18:36:02 +00:00
christos 521e0d5bd2 give a little more space 2014-11-08 00:47:32 +00:00
christos 74d147444a Now that the code can support tags and verbose route printing, enable them.
Also document previously undocumented flags.
2014-11-07 14:57:08 +00:00
christos 30f4c8e6f6 Factor out the netstat route printing code and use it here. There is no
point in having 2 different copies; fixes PR/49371
2014-11-06 21:29:32 +00:00
wiz 88a571cbd8 New sentence, new line. Bump date for previous. 2014-11-05 09:26:26 +00:00
mlelstv cfe8bb2a9d Add 'makewedges' option to autodiscover wedges from a changed label. 2014-11-04 08:00:44 +00:00
msaitoh 48b712a059 Add #include <inttypes.h> for intmax_t to fix compile error. 2014-11-04 03:05:43 +00:00
jakllsch d8015429ba ClusterOffset actually needs to be able to be negative. 2014-11-03 18:55:04 +00:00
mlelstv a62f667a0a fix logic that handles command line arguments. Now you can:
fsck /mnt/point
fsck dkX
fsck rdkX
fsck /dev/dkX
fsck /dev/rdkX
fsck NAME=wedge
2014-10-25 22:00:19 +00:00
mlelstv ab9ddb6964 Support wedge names.
before:
    newfs dk1        - formats /dev/rdk1
    newfs rdk1       - cannot open /dev/rrdk1
    newfs /dev/dk1   - /dev/dk1 is a block-device, use raw device
    newfs /dev/rdk1  - formats /dev/rdk1

now:
    newfs dk1        - formats /dev/rdk1
    newfs rdk1       - cannot open /dev/rrdk1
    newfs /dev/dk1   - formats /dev/rdk1 (*)
    newfs /dev/rdk1  - formats /dev/rdk1
    newfs NAME=wedge - formats /dev/rdk1

(*) getfsspecname() returns the block device which must be translated.
    Passing a block device manually cannot be distinguished from this case.
2014-10-25 16:47:23 +00:00
roy 38d2e3f021 Remove the ability for userland to toggle IN6_IFF_TENTATIVE.
Preserve IN6_IFF_TENTATIVE when updating address flags.
2014-10-20 14:50:09 +00:00
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
mrg d6a1b6b395 add a whole bunch of S.M.A.R.T. status i found around various sources.
now nothing on my new SSD is unknown, except #249.
2014-10-15 06:54:04 +00:00
riastradh c4ba54210e Paranoia: choke noisily on EOF from /dev/urandom. 2014-10-04 11:23:35 +00:00
riastradh ba983c7779 Make gpt(8) generate v4 (random) uuids.
Don't needlessly leak your date/time and MAC address when you edit
the disk.

Read from /dev/urandom rather than calling arc4random or anything,
since this is a tool.  (Cygwin seems to have /dev/urandom, but yell
if this breaks the build on your exotic platform because it lacks
/dev/urandom.)

ok apb
2014-10-04 10:30:13 +00:00
wiz ec23d78824 Remove trailing whitespace. 2014-10-04 07:15:54 +00:00
christos 279da39389 Allow specifying sector and media size on the command line. 2014-10-04 01:00:42 +00:00
christos 194a5fe433 provide a copy of the kernel uuid generator (with portable API calls) for
tools.
2014-10-03 20:30:06 +00:00
jnemeth 00433a3409 "0" is not guaranteed to be unique 2014-10-03 00:51:31 +00:00