1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

fsck_msdosfs(8): Optimimize memsets

Obtained from:	NetBSD (bin/50908)
MFC after:	2 weeks
This commit is contained in:
Pedro F. Giffuni 2016-04-06 15:28:26 +00:00
parent 5d58666c93
commit 33bed970fa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=297618

View File

@ -925,6 +925,7 @@ int
reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
{
struct dosDirEntry d;
int len;
u_char *p;
if (!ask(1, "Reconnect"))
@ -976,14 +977,15 @@ reconnect(int dosfs, struct bootblock *boot, struct fatEntry *fat, cl_t head)
boot->NumFiles++;
/* Ensure uniqueness of entry here! XXX */
memset(&d, 0, sizeof d);
(void)snprintf(d.name, sizeof(d.name), "%u", head);
/* worst case -1 = 4294967295, 10 digits */
len = snprintf(d.name, sizeof(d.name), "%u", head);
d.flags = 0;
d.head = head;
d.size = fat[head].length * boot->ClusterSize;
memset(p, 0, 32);
memset(p, ' ', 11);
memcpy(p, d.name, strlen(d.name));
memcpy(p, d.name, len);
memset(p + len, ' ', 11 - len);
memset(p + 11, 0, 32 - 11);
p[26] = (u_char)d.head;
p[27] = (u_char)(d.head >> 8);
if (boot->ClustMask == CLUST32_MASK) {