~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to src/journal/lookup3.c

  • Committer: Package Import Robot
  • Author(s): Michael Biebl, Michael Biebl, Michael Stapelberg, Daniel Schaal, Ondrej Balaz
  • Date: 2013-09-12 00:13:11 UTC
  • mfrom: (1.1.11) (9.1.2 experimental)
  • mto: This revision was merged to the branch mainline in revision 53.
  • Revision ID: package-import@ubuntu.com-20130912001311-dz35it34wr2lbday
Tags: 204-3
[ Michael Biebl ]
* Upload to unstable.
* Use /bin/bash in debug-shell.service as Debian doesn't have /sbin/sushell.
* Only import net.ifaces cmdline property for network devices.
* Generate strict dependencies between the binary packages using a
  shlibs.local file and add an explicit versioned dependency on
  libsystemd-login0 to systemd to ensure packages are upgraded in sync.
  Closes: #719444
* Drop obsolete Replaces: libudev0 from udev package.
* Use correct paths for various binaries, like /sbin/quotaon, which are
  installed in / and not /usr in Debian.  Closes: #721347
* Don't install kernel-install(8) man page since we don't install the
  corresponding binary either.  Closes: #722180
* Cherry-pick upstream fixes to make switching runlevels and starting
  reboot via ctrl-alt-del more robust.
* Cherry-pick upstream fix to properly apply ACLs to Journal files.

[ Michael Stapelberg ]
* Make systemctl enable|disable call update-rc.d for SysV init scripts.
  Closes: #709780
* Don't mount /tmp as tmpfs by default and make it possible to enable this
  feature via "systemctl enable tmp.mount".

[ Daniel Schaal ]
* Add bug-script to systemd and udev.  Closes: #711245

[ Ondrej Balaz ]
* Recognize discard option in /etc/crypttab.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
the public domain.  It has no warranty.
15
15
 
16
16
You probably want to use hashlittle().  hashlittle() and hashbig()
17
 
hash byte arrays.  hashlittle() is is faster than hashbig() on
 
17
hash byte arrays.  hashlittle() is faster than hashbig() on
18
18
little-endian machines.  Intel and AMD are little-endian machines.
19
19
On second thought, you probably want hashlittle2(), which is identical to
20
20
hashlittle() except it returns two 32-bit hashes for the price of one.
315
315
     * rest of the string.  Every machine with memory protection I've seen
316
316
     * does it on word boundaries, so is OK with this.  But VALGRIND will
317
317
     * still catch it and complain.  The masking trick does make the hash
318
 
     * noticably faster for short strings (like English words).
 
318
     * noticeably faster for short strings (like English words).
319
319
     */
320
320
#ifndef VALGRIND
321
321
 
337
337
    }
338
338
 
339
339
#else /* make valgrind happy */
340
 
 
341
 
    k8 = (const uint8_t *)k;
342
 
    switch(length)
343
340
    {
344
 
    case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
345
 
    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
346
 
    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
347
 
    case 9 : c+=k8[8];                   /* fall through */
348
 
    case 8 : b+=k[1]; a+=k[0]; break;
349
 
    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
350
 
    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
351
 
    case 5 : b+=k8[4];                   /* fall through */
352
 
    case 4 : a+=k[0]; break;
353
 
    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
354
 
    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
355
 
    case 1 : a+=k8[0]; break;
356
 
    case 0 : return c;
 
341
      const uint8_t *k8 = (const uint8_t *) k;
 
342
 
 
343
      switch(length)
 
344
      {
 
345
      case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
 
346
      case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
 
347
      case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
 
348
      case 9 : c+=k8[8];                   /* fall through */
 
349
      case 8 : b+=k[1]; a+=k[0]; break;
 
350
      case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
 
351
      case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
 
352
      case 5 : b+=k8[4];                   /* fall through */
 
353
      case 4 : a+=k[0]; break;
 
354
      case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
 
355
      case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
 
356
      case 1 : a+=k8[0]; break;
 
357
      case 0 : return c;
 
358
      }
357
359
    }
358
360
 
359
361
#endif /* !valgrind */
499
501
     * rest of the string.  Every machine with memory protection I've seen
500
502
     * does it on word boundaries, so is OK with this.  But VALGRIND will
501
503
     * still catch it and complain.  The masking trick does make the hash
502
 
     * noticably faster for short strings (like English words).
 
504
     * noticeably faster for short strings (like English words).
503
505
     */
504
506
#ifndef VALGRIND
505
507
 
522
524
 
523
525
#else /* make valgrind happy */
524
526
 
525
 
    k8 = (const uint8_t *)k;
526
 
    switch(length)
527
527
    {
528
 
    case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
529
 
    case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
530
 
    case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
531
 
    case 9 : c+=k8[8];                   /* fall through */
532
 
    case 8 : b+=k[1]; a+=k[0]; break;
533
 
    case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
534
 
    case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
535
 
    case 5 : b+=k8[4];                   /* fall through */
536
 
    case 4 : a+=k[0]; break;
537
 
    case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
538
 
    case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
539
 
    case 1 : a+=k8[0]; break;
540
 
    case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
 
528
      const uint8_t *k8 = (const uint8_t *)k;
 
529
      switch(length)
 
530
      {
 
531
      case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
 
532
      case 11: c+=((uint32_t)k8[10])<<16;  /* fall through */
 
533
      case 10: c+=((uint32_t)k8[9])<<8;    /* fall through */
 
534
      case 9 : c+=k8[8];                   /* fall through */
 
535
      case 8 : b+=k[1]; a+=k[0]; break;
 
536
      case 7 : b+=((uint32_t)k8[6])<<16;   /* fall through */
 
537
      case 6 : b+=((uint32_t)k8[5])<<8;    /* fall through */
 
538
      case 5 : b+=k8[4];                   /* fall through */
 
539
      case 4 : a+=k[0]; break;
 
540
      case 3 : a+=((uint32_t)k8[2])<<16;   /* fall through */
 
541
      case 2 : a+=((uint32_t)k8[1])<<8;    /* fall through */
 
542
      case 1 : a+=k8[0]; break;
 
543
      case 0 : *pc=c; *pb=b; return;  /* zero length strings require no mixing */
 
544
      }
541
545
    }
542
546
 
543
547
#endif /* !valgrind */
675
679
     * rest of the string.  Every machine with memory protection I've seen
676
680
     * does it on word boundaries, so is OK with this.  But VALGRIND will
677
681
     * still catch it and complain.  The masking trick does make the hash
678
 
     * noticably faster for short strings (like English words).
 
682
     * noticeably faster for short strings (like English words).
679
683
     */
680
684
#ifndef VALGRIND
681
685
 
698
702
 
699
703
#else  /* make valgrind happy */
700
704
 
701
 
    k8 = (const uint8_t *)k;
702
 
    switch(length)                   /* all the case statements fall through */
703
705
    {
704
 
    case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
705
 
    case 11: c+=((uint32_t)k8[10])<<8;  /* fall through */
706
 
    case 10: c+=((uint32_t)k8[9])<<16;  /* fall through */
707
 
    case 9 : c+=((uint32_t)k8[8])<<24;  /* fall through */
708
 
    case 8 : b+=k[1]; a+=k[0]; break;
709
 
    case 7 : b+=((uint32_t)k8[6])<<8;   /* fall through */
710
 
    case 6 : b+=((uint32_t)k8[5])<<16;  /* fall through */
711
 
    case 5 : b+=((uint32_t)k8[4])<<24;  /* fall through */
712
 
    case 4 : a+=k[0]; break;
713
 
    case 3 : a+=((uint32_t)k8[2])<<8;   /* fall through */
714
 
    case 2 : a+=((uint32_t)k8[1])<<16;  /* fall through */
715
 
    case 1 : a+=((uint32_t)k8[0])<<24; break;
716
 
    case 0 : return c;
 
706
      const uint8_t *k8 = (const uint8_t *)k;
 
707
      switch(length)                   /* all the case statements fall through */
 
708
      {
 
709
      case 12: c+=k[2]; b+=k[1]; a+=k[0]; break;
 
710
      case 11: c+=((uint32_t)k8[10])<<8;  /* fall through */
 
711
      case 10: c+=((uint32_t)k8[9])<<16;  /* fall through */
 
712
      case 9 : c+=((uint32_t)k8[8])<<24;  /* fall through */
 
713
      case 8 : b+=k[1]; a+=k[0]; break;
 
714
      case 7 : b+=((uint32_t)k8[6])<<8;   /* fall through */
 
715
      case 6 : b+=((uint32_t)k8[5])<<16;  /* fall through */
 
716
      case 5 : b+=((uint32_t)k8[4])<<24;  /* fall through */
 
717
      case 4 : a+=k[0]; break;
 
718
      case 3 : a+=((uint32_t)k8[2])<<8;   /* fall through */
 
719
      case 2 : a+=((uint32_t)k8[1])<<16;  /* fall through */
 
720
      case 1 : a+=((uint32_t)k8[0])<<24; break;
 
721
      case 0 : return c;
 
722
      }
717
723
    }
718
724
 
719
725
#endif /* !VALGRIND */