lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.0905262202390.27902@gandalf.stny.rr.com>
Date:	Tue, 26 May 2009 22:15:15 -0400 (EDT)
From:	Steven Rostedt <rostedt@...dmis.org>
To:	Li Zefan <lizf@...fujitsu.com>
cc:	Ingo Molnar <mingo@...e.hu>, Jens Axboe <jens.axboe@...cle.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Tom Zanussi <tzanussi@...il.com>,
	Theodore Ts'o <tytso@....edu>,
	Steven Whitehouse <swhiteho@...hat.com>,
	KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
	Jeff Moyer <jmoyer@...hat.com>,
	Christoph Hellwig <hch@...radead.org>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2 1/2] tracing/events: make __string() more general


On Wed, 27 May 2009, Li Zefan wrote:
> >>
> >> With __string(..., src), we need to have a source string, but sometimes no
> >> source string is available, and what we know is how big the string will be.
> >>
> >> Take block trace events for example, I want to convert an unsigned char array
> >> into a string, after this patch, this can be done this way:
> >>
> >> TP_STRUCT_entry(
> >> 	__string( cmd, rq->cmd_len * 3 )
> >> )
> >>
> >> TP_fast_assign(
> >> 	construct_str( cmd )
> > 
> > What does the construct_str do?
> > 
> 
> Ah, it's pseudo code.. Should be construct_str(__entry->cmd, rq),
> this helper function convert rq->cmd (unsigned char[]) to a string of
> hex dump.
> 
> No source string is available, so I'm not calling assign_str() in
> TP_fast_assign.

OK, I think I have a better understanding of what you are doing.

But, I don't like changing the interface for string by adding that 
"strlen" to all users. I find that very ugly.

Could we instead perhaps add a __dynamic_array? That would take a length, 
and append itself to after the strings?

stage 1:

#define __dynamic_array(item, len)	int __dyn_loc_##item;

stage 2:

#define __dynamic_array(item, len)	int item;

stage 3:

#define __get_dynamic_array(item)	\
	((void *)__entry + __entry->__str_loc_##field

stage 4:

#define __dynamic_array(item, len)	\
	__str_offsets.item = __str_size + \
		offsetof(typeof(*entry), __str_data);	\
	__str_size += len;


And so on. You should be able to do something like this, and make it more 
generic.

-- Steve

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ